/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package engine.entities;

import engine.entities.inventory.PartyInventory;

/**
 *
 * @author NathanT
 */
public class Party {
    
    public static final int PARTY_SIZE = 4;
    private final Player[] members = new Player[PARTY_SIZE];
    
    private final PartyInventory inventory;
    
    private int selection;
    private Player selectedPlayer;
    
    public Party(Player[] members, PartyInventory inventory) {
        for (int i = 0; i < this.members.length; i++) {
            if (i < members.length) {
                this.members[i] = members[i];
            }
            else {
                this.members[i] = null;
            }
        }
        
        this.inventory = inventory;
    }
    
    public Player getPlayer(int i) {
        if (i < this.members.length && i >= 0) {
            return this.members[i];
        }
        return null;
    }
    
    public void setPlayer(int i, Player player) {
        if (i < this.members.length && i >= 0) {
            this.members[i] = player;
        }
    }
    
    public PartyInventory getInventory() {
        return this.inventory;
    }
    
    public void selectPlayer(int i) {
        if (i < this.members.length && i >= 0) {
            selectedPlayer = this.members[i];
            selection = i;
        }
    }
    
    public int getSelectedPlayerIndex() {
        return selection;
    }
    
    public Player getSelectedPlayer() {
        return selectedPlayer;
    }
    
}
